package sentity

import (
	"path/filepath"
	"server/application/db/schema/dbops"
	"time"

	"gorm.io/gorm"
)

type TripItem struct {
	ID        uint           `gorm:"primarykey;comment:ID" json:"id"`
	TripID    uint           `gorm:"column:trip_id;comment:旅行ID" json:"trip_id"`
	ItemName  string         `gorm:"column:item_name;comment:物品名称;type:varchar(100)" json:"item_name"`
	Quantity  uint           `gorm:"default:1;comment:数量" json:"quantity"`
	CreatedAt time.Time      `gorm:"column:created_at;comment:创建时间" json:"created_at,omitempty"`
	UpdatedAt time.Time      `gorm:"column:updated_at;comment:更新时间" json:"updated_at,omitempty"`
	DeletedAt gorm.DeletedAt `gorm:"index;column:deleted_at;comment:删除时间" json:"deleted_at,omitempty"`
}

// GenConfig 生成相关配置
func (u TripItem) GenConfig() dbops.EntityConfig {
	return dbops.EntityConfig{
		Title:             "用户",
		AsName:            "",                       //实体别名，请使用大驼峰命名法
		ViewsFatherFolder: filepath.Join("account"), //视图父目录
		TableName:         "trip_items",
	}
}

// 表名
func (TripItem) TableName() string {
	return "trip_items"
}
